# -*- coding: utf-8 -*-
"""
读写csv
"""

import pandas as pd
from pandas import DataFrame

# 读
df = pd.read_csv(r'test.csv',encoding='gb2312')   # 参数encoding控制读取中文


# 写
data={
'name':['张三','李四','王五'],
'age':[11,12,13],
'sex':['男','女','男'],
}
df=DataFrame(data)
#将DataFrame存储为csv,index表示是否显示行名，default=True
df.to_csv('new.csv', index=False, sep=',')











